/**
 * Copyright (c) 2007 Emilio Monti
 * 
 * This file is released under the GPLv2
 */
package searchtab.highlight;

import java.util.ArrayList;

import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.IAnnotationModel;

public class MarkerManager {

    private MarkerHighlighter highlighter;

    public void setMarkers(IAnnotationModel annotationModel, ArrayList<Position> matches) {
        if (highlighter != null) {
            deleteMarkers();
        }
        highlighter = new MarkerHighlighter(annotationModel);
        highlighter.addHighlights(matches);
    }

    public void deleteMarkers() {
        if (highlighter != null) {
            highlighter.removeAll();
            highlighter = null;
        }
    }
}
